const mybehavior = require("../../behaviors/requests")
// components/record_list/list.js
Component({
  /**
   * 组件的属性列表
   */
  behaviors: [mybehavior],
  properties: {
    list : {
      type: Array,
      value: []
    },
    list1 : {
      type: Array,
      value: []
    },
    index : {
      type: Number,
      value: 1
    },
    total : {
      type: Number,
      value: 0
    },
  
   
  },

  /**
   * 组件的初始数据
   */
  data: {
   
  },
  /**
   * 组件的方法列表
   */

  methods: {
    pageUp(){
      let now_index = this.data.index
      if (now_index > 1) {
        now_index = now_index - 1
        let l = this.data.list
        let show_list = []
        show_list.push(l[now_index-1])
        this.setData({
          index: now_index,
          list1: show_list,
        })   
      }
    },
    pageDown(){
      let now_index = this.data.index
      if (now_index < this.data.total) {
        now_index = now_index + 1
        let l = this.data.list
        let show_list = []
        show_list.push(l[now_index-1])
        console.log('xx',show_list);
        this.setData({
          list1: show_list,
          index: now_index
        })
   
      }
    },
    

  }
})
